Computer networks allow different parts of an application program to be executed by different computers. Traditional distribution of application processing used a transportation-based model of network operation in which an application program used relatively low level I/O commands of the network operating system.
More recently, a procedure-based model has been developed to allow an application program to use relatively high level commands or calls to distribute processing of the application. A procedure-based model of distributed processing may be implemented as a remote procedure call facility, such as the type incorporated in the Windows NT operating system of Microsoft Corporation.
Computer programs typically include one or more functions, procedures, or similar program units that are referred to herein as "procedures." Each procedure generally includes a block of programming or code that implements a particular operation or functionality on a set of values referred to as parameters or arguments.
Whenever the operation or functionality is to be performed, a call is made to the procedure. The call passes to the procedure values or parameters as arguments, together with control of the processor. After the procedure is completed, control returns to the point in the program following the call, together with any resulting value or values generated by the procedure.
Procedure calls may access procedures that are local to the calling processor. Alternatively, an application program executed on one computer (the "client") may use a remote procedure call to have another computer (the "server") perform a selected procedure.
The remote procedure call is generated by and modeled in the application program in the client in substantially the same manner as a conventional local procedure call would be. The remote procedure call typically includes parameters that are, include, point to, or identify data or data structures used to execute the remote procedure.
Stub procedures that are generated by a remote procedure call facility, typically a component of the network operating system, format the remote procedure call parameters for transmission to the server. As a result, an application programmer may use distributed processing of an application program without incorporating into it low level network transport instructions.
Whenever an application program makes a remote procedure call, the application accesses a client stub procedure that formats or marshals the remote procedure call parameters within a buffer for transmission over the network to the server. The client stub procedure may be included in the application program or a separate dynamic-link library (DLL) of stub procedures used by the application. The marshalling of the parameters may include, for example, resolving references to parameters in the remote procedure call and attaching any data structures or parameters referred to by pointers.
The client stub procedure also calls a runtime procedure that executes transmission of the marshalled buffer containing the remote procedure call parameters to the server. The execution of transmission by the runtime procedure includes identifying the server where the remote procedure should be executed, determining the transport mechanism used by the server, and sending the call to the server.
A runtime procedure on the server receives the remote procedure call request and delivers an RPC buffer containing the remote procedure call parameters to a server stub procedure. The server stub procedure unmarshals each of the parameters separately, which includes separately allocating server memory for each parameter and any of the data structures it references through pointers, and then copying the parameters or data structures from the RPC buffer into the newly allocated server memory.
The server stub procedure then calls the server to execute the remote procedure. After the remote procedure is completed, the server stub procedure marshals any output parameters or return values to be transmitted back to the client. The server stub procedure then frees the memory it allocated to hold the remote procedure call parameters and returns to the runtime procedure.
The goals of distributed application processing are to improve the speed at which an application is executed and the efficiency with which network processing resources are used. Due to the relative performance capabilities or availability of resources at different processors, such improvements can be obtained despite the resources required to transmit and interpret remote procedure calls and their results.
However, the processing of remote procedure calls is typically considered to require at least certain minimum system resources. Unmarshalling remote procedure call parameters at a server is one of the required processes that can be particularly burdensome on system resources.
Memory allocation and subsequent freeing are relatively demanding of system resources. Separately allocating server memory for each parameter and data structure of a remote procedure call could possibly require hundreds of separate memory allocations for a single remote procedure call. Such repeated execution of a demanding system process such as memory allocation can severely limit the performance of remote procedure calls.
In accordance with the present invention, a computer network includes a client and a server which are preferably independently operable computers that cooperate to perform different procedures of an application program. The server executes its procedure in response to a remote procedure call transmitted over the computer network from the client.
The remote procedure call typically includes parameters that are, include, point to, or identify data or data structures that are arguments used by the remote procedure. The parameters, including data and data structures, all have selected data formats according to a client system data format used by the client.
The server receives the remote procedure call at an RPC buffer. In accordance with the present invention, the server determines whether the data format of the remote procedure call parameters match a server system data format used by the server. Preferably, the server system data format includes a byte order format and a server memory format.
Whenever the data format of a remote procedure call parameter in the RPC buffer matches the server system data format, the remote procedure call parameter is unmarshalled while it resides in the RPC buffer. Whenever the data format of a remote procedure call parameter in the RPC buffer does not match and cannot be converted to match the server system data format, server memory is allocated for the remote procedure call parameter and it is copied from the RPC buffer to the allocated server memory for unmarshalling in the conventional manner.
Unmarshalling remote procedure call parameters while they reside in the RPC buffer ("in situ unmarshalling") eliminates separate allocation of server memory for each parameter or data structure. Since allocating memory expends substantial system time or resources, eliminating repetitious use of the memory allocation process according to this invention can significantly enhance the performance capabilities of remote procedure calls.
Remote procedure call parameters, including data and data structures, may be either of two possible byte order formats according to the client system data format. The two byte order formats, sometimes called Endians or Endian formats, relate to the relative positions of the most- and least-significant bytes in a data structure. The server system data format is also one of the two possible byte order formats.
In accordance with another aspect of this invention, the server determines whether remote procedure call parameters and the server system data format have the same byte order format. Whenever the remote procedure call parameters and the server system data format have different byte order formats, the byte order format of the remote procedure call parameters is converted to match the byte order format of the server system data format while the parameters reside in the RPC buffer. As a result, remote procedure call parameters can be unmarshalled from within the RPC buffer according to this invention regardless of whether the client and server share the same byte order format.
The foregoing and other features and advantages of the preferred embodiment of the present invention will be more readily apparent from the following detailed description, which proceeds with reference to the accompanying drawings.